<?php
$gametype=getvar("gtype");
echo "<table border=0>";
switch($gametype)
{
	case "0":
		$color = array("", "r", "b01", "g01");
		$rs = getdb("select n1,n2,n3,n4,n5,n6,spec,round from lotto where n1>0 order by id desc limit 1");
		if(!$rs->eof)
		{
			$n1=sprintf("%02d",$rs->f["n1"]);
			$n2=sprintf("%02d",$rs->f["n2"]);
			$n3=sprintf("%02d",$rs->f["n3"]);
			$n4=sprintf("%02d",$rs->f["n4"]);
			$n5=sprintf("%02d",$rs->f["n5"]);
			$n6=sprintf("%02d",$rs->f["n6"]);
			$spec=sprintf("%02d",$rs->f["spec"]);
			echo '<tr>
			<td width="165" align="right"><strong style="color:#FF0000; font-size:14px; font-weight:bold; ">'.d3($rs->f["round"]).'期开奖&nbsp;</strong></td>
			<td height="30" width="29" class="ball_'.$color[$g_numcolor[$rs->f["n1"]]].'">'.$n1.'</td>
			<td height="30" width="29" class="ball_'.$color[$g_numcolor[$rs->f["n2"]]].'">'.$n2.'</td>
			<td height="30" width="29" class="ball_'.$color[$g_numcolor[$rs->f["n3"]]].'">'.$n3.'</td>
			<td height="30" width="29" class="ball_'.$color[$g_numcolor[$rs->f["n4"]]].'">'.$n4.'</td>
			<td height="30" width="29" class="ball_'.$color[$g_numcolor[$rs->f["n5"]]].'">'.$n5.'</td>
			<td height="30" width="29" class="ball_'.$color[$g_numcolor[$rs->f["n6"]]].'">'.$n6.'</td>
			<td height="30" width="15" align="center"><span style="font-size:24px; font-weight:bold; color:#FF0000; ">+</span></td>
			<td height="30" width="29" class="ball_'.$color[$g_numcolor[$rs->f["spec"]]].'">'.$spec.'</td>
			</tr>
			';
		}
		$rs->close();
		break;
	case 11:
	case 12:
	case 13:
	case 14:
	case 15:
		$rs = getdb("select n1,n2,n3,n4,n5,round from lotto_".$g_gametype_3d[$gametype]['en']." where  startbet<='" . date("Y-m-d H:i:s") . "' and n1>=0 order by startbet desc limit 10");
		if(!$rs->eof)
		{
			echo '<tr>
			<td width="195" align="right"><strong style="color:#FF0000; font-size:14px; font-weight:bold; ">'.d3($rs->f["round"]).'期开奖&nbsp;</strong></td>
			<td height="30" width="25"><img src="skin/1/img/ball/pic'.intval($rs->f["n5"]).'.png"></td>
			<td height="30" width="25"><img src="skin/1/img/ball/pic'.intval($rs->f["n4"]).'.png"></td>
			<td height="30" width="25"><img src="skin/1/img/ball/pic'.intval($rs->f["n3"]).'.png"></td>
			<td height="30" width="25"><img src="skin/1/img/ball/pic'.intval($rs->f["n2"]).'.png"></td>
			<td height="30" width="25"><img src="skin/1/img/ball/pic'.intval($rs->f["n1"]).'.png"></td>
			</tr>
			';
		}
		$rs->close();
		break;
	case 20:
	case 21:
	case 22:
	case 23:
		$rs = getdb("select n1,n2,n3,n4,n5,n6,n7,n8,round from lotto_".$g_gametype_3d[$gametype]['en']." where  startbet<='" . date("Y-m-d H:i:s") . "' and n1>=0 order by startbet desc limit 1");
		if(!$rs->eof)
		{
			$n1=sprintf('%02d',$rs->f["n1"]);
			$n2=sprintf('%02d',$rs->f["n2"]);
			$n3=sprintf('%02d',$rs->f["n3"]);
			$n4=sprintf('%02d',$rs->f["n4"]);
			$n5=sprintf('%02d',$rs->f["n5"]);
			$n6=sprintf('%02d',$rs->f["n6"]);
			$n7=sprintf('%02d',$rs->f["n7"]);
			$n8=sprintf('%02d',$rs->f["n8"]);
			if($gametype==23)
			{
				echo '<tr>
				<td  align="right" nowrap="nowrap"><strong style="color:#FF0000; font-size:14px; font-weight:bold; ">'.($rs->f["round"]).'期开奖&nbsp;</strong></td>
				<td height="30" width="40" class="cent_ncnumber0 cent_ncnum'.$n1.'"></td>
				<td height="30" width="40" class="cent_ncnumber0 cent_ncnum'.$n2.'"></td>
				<td height="30" width="40" class="cent_ncnumber0 cent_ncnum'.$n3.'"></td>
				<td height="30" width="40" class="cent_ncnumber0 cent_ncnum'.$n4.'"></td>
				<td height="30" width="40" class="cent_ncnumber0 cent_ncnum'.$n5.'"></td>
				<td height="30" width="40" class="cent_ncnumber0 cent_ncnum'.$n6.'"></td>
				<td height="30" width="40" class="cent_ncnumber0 cent_ncnum'.$n7.'"></td>
				<td height="30" width="40" class="cent_ncnumber0 cent_ncnum'.$n8.'"></td>
				</tr>
				';
			}else
			{
				echo '<tr>
				<td width="150"  nowrap="nowrap" align="right"><strong style="color:#FF0000; font-size:14px; font-weight:bold; ">'.($rs->f["round"]).'期开奖&nbsp;</strong></td>
				<td height="30" width="40" class="ball_'.($n1<=18?'yellow01':'red02').'">'.$n1.'</td>
				<td height="30" width="40" class="ball_'.($n2<=18?'yellow01':'red02').'">'.$n2.'</td>
				<td height="30" width="40" class="ball_'.($n3<=18?'yellow01':'red02').'">'.$n3.'</td>
				<td height="30" width="40" class="ball_'.($n4<=18?'yellow01':'red02').'">'.$n4.'</td>
				<td height="30" width="40" class="ball_'.($n5<=18?'yellow01':'red02').'">'.$n5.'</td>
				<td height="30" width="40" class="ball_'.($n6<=18?'yellow01':'red02').'">'.$n6.'</td>
				<td height="30" width="40" class="ball_'.($n7<=18?'yellow01':'red02').'">'.$n7.'</td>
				<td height="30" width="40" class="ball_'.($n8<=18?'yellow01':'red02').'">'.$n8.'</td>
				</tr>
				';
			}
		}
		$rs->close();
		break;
	case 24:
		$rs = getdb("select n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,round from lotto_".$g_gametype_3d[$gametype]['en']." where n1>=0 order by startbet desc limit 1");
		if(!$rs->eof)
		{
			$n1=intval($rs->f["n1"]);
			$n2=intval($rs->f["n2"]);
			$n3=intval($rs->f["n3"]);
			$n4=intval($rs->f["n4"]);
			$n5=intval($rs->f["n5"]);
			$n6=intval($rs->f["n6"]);
			$n7=intval($rs->f["n7"]);
			$n8=intval($rs->f["n8"]);
			$n9=intval($rs->f["n9"]);
			$n10=intval($rs->f["n10"]);
			echo '<tr>
			<td width="195" align="right"><strong style="color:#FF0000; font-size:14px; font-weight:bold; ">'.d3($rs->f["round"]).'期开奖&nbsp;</strong></td>
			<td height="20" width="25" class="pk10_'.$n1.'">'.$n1.'</td>
			<td height="20" width="25" class="pk10_'.$n2.'">'.$n2.'</td>
			<td height="20" width="25" class="pk10_'.$n3.'">'.$n3.'</td>
			<td height="20" width="25" class="pk10_'.$n4.'">'.$n4.'</td>
			<td height="20" width="25" class="pk10_'.$n5.'">'.$n5.'</td>
			<td height="20" width="25" class="pk10_'.$n6.'">'.$n6.'</td>
			<td height="20" width="25" class="pk10_'.$n7.'">'.$n7.'</td>
			<td height="20" width="25" class="pk10_'.$n8.'">'.$n8.'</td>
			<td height="20" width="25" class="pk10_'.$n9.'">'.$n9.'</td>
			<td height="20" width="25" class="pk10_'.$n10.'">'.$n10.'</td>
			</tr>
			';
		}
		$rs->close();
		break;
	case 25:
	case 26:
		$rs = getdb("select n1,n2,n3,round from lotto_".$g_gametype_3d[$gametype]['en']." where n1>=0 order by startbet desc limit 1");
		if(!$rs->eof)
		{
			$n1=intval($rs->f["n1"]);
			$n2=intval($rs->f["n2"]);
			$n3=intval($rs->f["n3"]);
			echo '<tr>
			<td width="195" align="right"><strong style="color:#FF0000; font-size:14px; font-weight:bold; ">'.($rs->f["round"]).'期开奖&nbsp;</strong></td>
			<td height="20" width="25"><img src="skin/1/img/ball/'.$n3.'.png" width="25"></td>
			<td height="20" width="25"><img src="skin/1/img/ball/'.$n2.'.png" width="25"></td>
			<td height="20" width="25"><img src="skin/1/img/ball/'.$n1.'.png" width="25"></td>
			</tr>
			';
		}
		$rs->close();
		break;
		
}
echo "</table>"
?>